import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import 'element-plus/dist/index.css'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import * as Icons from '@element-plus/icons'
// 全局配置中文组件
import zhCn from 'element-plus/es/locale/lang/zh-cn'



const pinia = createPinia()
const app = createApp(App)

// 把驼峰转换成横杠连接
const toLine = (value) => {
  return value.replace(/(A-Z)g/, '-$1').toLocaleLowerCase()
}

for (let i in Icons) {
  // 注册全部组件
  app.component(`el-icon-${toLine(i)}`, Icons[i])
  app.component(i, Icons[i])
}

// 注册插件
app.use(pinia)
app.use(ElementPlus, { locale: zhCn,})
app.use(router).mount('#app')


